#ifndef MUSICENGINE_H
#define MUSICENGINE_H

#include <Phonon>
#include <Phonon/MediaObject>
#include <Phonon/AudioOutput>

typedef Phonon::MediaSource SRC;

class MusicEngine : public QObject
{
	Q_OBJECT

public:
	MusicEngine();
	~MusicEngine();
signals:
	void currenttime(qint64);
	void fileInfo(QMultiMap<QString,QString>,bool);
	void Finished();
	void beforeplay();
	void beforepause();
private slots:
	void CurrentTime(qint64 time_ms);
	void DataChange();
	void Finish();
public:
	void Init();
	void Play();
	void Pre();
	void Next();
	void Pause();
	void SetTickIn(qint64 time_ms);
	void SetFileInfo();
	void setSongPos(qint64 time_ms);
	void setPlayList(QList<SRC> &lst);
	void setPlay(SRC src);
	void setSRC(SRC src);
	void setVolume(float vol);
	void SetCurrentIndex(int index);
	float Volume();
	qint64 GetTickIn();
	qint64 getTotalTime();
	QMultiMap<QString,QString> Data();
	QString Data(QString &key);
private:
	Phonon::MediaObject *m_Mobj;
	Phonon::AudioOutput *m_Output;
	QList<SRC> m_slist;  // no use
	QMultiMap<QString,QString> m_fileInfo;
	int tickIn;
	int current;   // no use
};

#endif // MUSICENGINE_H
